package org.example;

import com.alibaba.fastjson.JSONObject;
import org.omg.CORBA.FixedHolder;
import org.omg.CORBA.StringHolder;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName JSONTEST
 * @Description
 * @Author zhangsw
 * @Date 2020/10/31 14:59
 * @Version 1.0
 */
public class JSONTEST {
    public static void main(String[] args) {
        List<Integer> count = new ArrayList<>();
        List<Integer> c50 = new ArrayList<>();
        List<Integer> c200 = new ArrayList<>();

        for (int i = 0; i < 1000000; i++) {
            //随机生成50 ~ 200
            int x=(int)(Math.random()*151+50);
            if (x > 200 || x < 50) {
                count.add(x);
                System.out.println(x);
            }
            if (x == 50) {
                c50.add(x);
            }
            if (x == 200) {
                c200.add(x);
            }
            System.err.println(x);
        }
        System.out.println("===========================");
        System.out.println("数量："+count.size());
        System.out.println("50数量："+c50.size());
        System.out.println("200数量："+c200.size());


//        String a = null;
//        String s = String.valueOf(a);
//        System.err.println(s);


//        List<Object> list = new ArrayList<>();
//        list.add("111111");
//        list.add("1111121");
//        List<Object> list = null;
//        if (list !=null && !list.isEmpty() && list.size() > 0) {
//            System.err.println("不为空");
//        }

//        if (list !=null && !list.isEmpty() && list.size() > 0) {
//        list
//        if (list !=null && !list.isEmpty() && list.size() > 0) {
//
//        }
    }

    public static boolean isNotEmpty(List<Object> list) {
        return list != null && list.size() > 0;
    }

    /**
     * 2020双十一办理业务添加能量方法
     * @param phoneNum
     * @param type
     */
    public static void addEnergy(String phoneNum, String type) {
        String params = phoneNum + "&" + type;
        JSONObject jo = new JSONObject();
        JSONObject j1 = new JSONObject();
        j1.put("params", params);
        JSONObject j2 = new JSONObject();
        j2.put("mac", "");
        jo.put("sec", j2);
        jo.put("in", j1);
        System.err.println(jo.toString());
    }
}
